import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘国水
 * Date: 2025-06-15
 * Time: 19:37
 */
public class test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] arr = {1,2,3,4,5,6,7,8,9};

        //二分查找
        int left = 0;
        int right = arr.length - 1;
        int ret = scanner.nextInt();
        while (left <= right) {
            int mid = (left + right) / 2;
            if(ret < arr[mid]) {
                right = mid - 1;
            } else  if (ret > arr[mid]) {
                left = mid + 1;
            } else {
                System.out.println("找到了下标是；" + mid);
                break;
            }
        }




    }
    public static void main2(String[] args) {
        int[] arr1 = {1,2,1,3,4,5,6};
        int[] arr2 = arr1;

        System.out.println("arr1：" + Arrays.toString(arr1));
        System.out.println("arr2：" + Arrays.toString(arr2));
    }
    public static void main1(String[] args) {
        int[] arr = {60,51,23,52,1,6,9};
        bubbleSort1(arr);
        System.out.println(Arrays.toString(arr));
    }

    public static void bubbleSort(int[] arr) {
        for (int i = 0; i < arr.length; i++) {
            for (int j = 1; j < arr.length - i; j++) {
                if(arr[j-1] > arr[j]) {
                  int ret = arr[j-1];
                  arr[j-1] = arr[j];
                  arr[j] = ret;
                }
            }
        }
    }

    public static void bubbleSort1(int[] array) {
        for (int i = 0; i <= array.length; i++) {
            for (int j = 0; j < array.length - i ; j++) {
                if(array[j] > array[j+1]) {
                    int tep = array[j];
                    array[j] = array[j+1];
                    array[j+1] = tep;
                }
            }
        }
    }


}
